package com.jingyi.system.service.impl;

import com.jingyi.common.core.domain.entity.WxResource;
import com.jingyi.system.mapper.WxResourceMapper;
import com.jingyi.system.service.IWxResourceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 医疗记录图片信息 业务层处理
 *
 * @author jingyi
 */
@Service
public class WxResourceServiceImpl implements IWxResourceService {
    @Autowired
    private WxResourceMapper wxResourceMapper;

    /**
     * 通过医疗记录ID查询患者
     *
     * @param recordId 医疗记录ID
     * @return 图片信息
     */
    @Override
    public List<WxResource> selectResourceByRecordId(Long recordId) {
        return wxResourceMapper.selectResourceByRecordId(recordId);
    }

    /**
     * 通过图片信息ID查询患者
     *
     * @param resourceId 图片信息ID
     * @return 图片信息
     */
    @Override
    public List<WxResource> selectResourceById(Long resourceId) {
        return wxResourceMapper.selectResourceById(resourceId);
    }

    /**
     * 修改图片信息信息
     *
     * @param resource 图片信息
     * @return 结果
     */
    @Override
    @Transactional
    public int updateResource(WxResource resource) {
        return wxResourceMapper.updateResource(resource);
    }

    /**
     * 新增图片信息信息
     *
     * @param resource 图片信息
     * @return 结果
     */
    @Override
    @Transactional
    public int insertResource(WxResource resource) {
        return wxResourceMapper.insertResource(resource);
    }

    /**
     * 通过图片信息ID删除图片信息
     *
     * @param resourceId 图片信息ID
     * @return 结果
     */
    @Override
    @Transactional
    public int deleteResourceById(Long resourceId) {
        return wxResourceMapper.deleteResourceById(resourceId);
    }

    /**
     * 批量删除图片信息信息
     *
     * @param resourceIds 需要删除的图片信息ID
     * @return 结果
     */
    @Override
    @Transactional
    public int deleteResourceByIds(Long[] resourceIds) {
        return wxResourceMapper.deleteResourceByIds(resourceIds);
    }

    /**
     * 通过记录ID删除图片信息
     *
     * @param recordId 记录ID
     * @return 结果
     */
    @Override
    @Transactional
    public int deleteResourceByRecordId(Long recordId) {
        return wxResourceMapper.deleteResourceByRecordId(recordId);
    }
}
